home *** CD-ROM | disk | FTP | other *** search
- /*
- Header file for Message Dispatcher
-
- You can call OpenDispatch to start the dispatcher
-
- You can call Receive multiple times with different completion routines
- The message selection can be different.
- The first match is used
-
- You can call CloseDispatch to stop the dispatcher
-
- Written by: Anumele D. Raja
-
- Date: April 18, 1991
-
- Copyright @ Apple Computer, Inc. 1991
-
- */
-
- #ifndef __MESSAGEDISPATCHER__
- #define __MESSAGEDISPATCHER__
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #ifndef _os_defined_
- #include "os.h"
- #endif
-
- #define kNoOfDispatchEntriesInBlock 16
-
- #define kFailedReceive -66
-
- struct MessageQueue {
- int fMsgCount;
- mMessage *fMsgPtr[];
- };
-
- typedef struct MessageQueue MessageQueue;
-
- struct DispatchEntry {
- int fFlag;
- long fMsgId;
- tid_type fMsgFrom;
- short fMsgCode;
- long fTimeOut;
- void (*fComplRout)(mMessage *);
- };
-
- typedef struct DispatchEntry DispatchEntry;
-
- typedef struct DispatchTable DispatchTable;
-
- struct DispatchTable {
- DispatchTable **fNext;
- DispatchEntry disEntry[kNoOfDispatchEntriesInBlock];
- };
-
- void OpenDispatch(int queueSize);
- void CloseDispatch(void);
- void SetSpecialReceive(void);
- void RestoreOriginalReceive(void);
- mMessage *SpecialReceive(unsigned long msgId, tid_type msgFrom,
- unsigned short msgCode, long timeOut, void (*complRout)(mMessage *));
-
- #endif